/**
 * Copyright 2015 Qiyi Inc. All rights reserved.
 *
 * @file:   Carousel.Task.js
 * @author: karkarrotxu@qiyi.com
 * @date:   2016-05-30
 */
qui(
    function (require, exports, module) {
        Carousel.Task = $.extend({}, EpgWeb.Task, {
            getLiveProgramTypeTask: function (taskName) {
                var self = this;
                return self.getConfigType(taskName)
            },
            getContentTypeTask: function (taskName) {
                var self = this;
                return self.getConfigType(taskName)
            },
            platformsTask: function (taskName) {
                var self = this;
                return self.getConfigType(taskName)
            },
            getLogType:function(taskName){
                var self = this;
                return self.getConfigType(taskName)
            },
            getAdDuration:function(taskName){
                var self = this;
                return self.getConfigType(taskName ,function (data) {
                    var selectJDom = $("select[name=advert_select]");
                    $.each(data.data, function (index, obj) {
                        $("<option>", {
                            value:obj.key,
                            html: obj.descr
                        }).appendTo(selectJDom);
                    });
                })
            },
            getPlatformReferTask: function (taskName) {
                var self = this;
                return self.getConfigType(taskName)
            },
            platSettingsTask:function( regName,data){
                return {
                    regName: regName,
                    options: {
                        type: "post",
                        url: EpgWeb.urlConfig.platSettingsGetUrl,
                        dataType: "json",
                        data: data
                    }
                }
            },
            checkForQipuDataTask:function ( callbackHandler ) {
            return {
                regName: "checkForQipu",
                options: {
                    url: EpgWeb.urlConfig.redirect,
                    dataType: "json",
                    type: "post"
                },
                handler: function (options) {
                    callbackHandler( options );
                }
            }
        }
        });
    }
);